package edu.washington.cs.workflow.spec4j.example;

import java.awt.Component;
import java.awt.Frame;

import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import javax.swing.JSplitPane;

import samples.addressbook.main.Main;
import junit.framework.TestCase;

public class TestEnumerateComps extends TestCase {

	public void testEnumerateComps() throws Exception {
		Main.main(new String[]{});
		System.out.println(Frame.getFrames().length);
		Frame f = Frame.getFrames()[0];
		System.out.println(f.getTitle());
		Component[] cs = f.getComponents();
		System.out.println(cs.length);
		System.out.println(cs[0]);
		
		javax.swing.JRootPane pane = (javax.swing.JRootPane)cs[0];
		System.out.println(pane.getComponent(0));
		System.out.println(pane.getComponent(1));
		
	}
	
	public static void main(String[] args) throws Exception {
		Main.main(new String[]{});
		System.out.println(Frame.getFrames().length);
		Frame f = Frame.getFrames()[0];
		System.out.println(f.getTitle());
		Component[] cs = f.getComponents();
		System.out.println(cs.length);
		System.out.println(cs[0]);
		
		javax.swing.JRootPane pane = (javax.swing.JRootPane)cs[0];
		System.out.println(pane.getComponent(0));
		System.out.println(pane.getComponent(1));
		
		JLayeredPane lp = (JLayeredPane)pane.getComponent(1);
		System.out.println(lp.getComponent(0));
		
		JPanel lp1 = (JPanel)lp.getComponent(0);
		System.out.println(lp1.getComponent(0).getClass());
		
		JSplitPane jsp = (JSplitPane)lp1.getComponent(0);
		System.out.println(jsp.getComponent(0));
	}
}
